package com.gitee.mrj.aiboot.core.controller;


import com.gitee.mrj.aiboot.core.model.AibootPost;
import com.gitee.mrj.aiboot.core.sf.generators.UIForm;
import com.gitee.mrj.aiboot.core.sf.schema.UiFormSchemaGenerator;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class BuildController {

    @GetMapping("/build")
    public UIForm build() throws Exception {
        Map<String, Object> map = new HashMap<>();
        UIForm uiForm = UiFormSchemaGenerator.generate(AibootPost.class);
//        map.put("schema", uiForm);
//        map.put("ui", UISchemaUtil.build(EruptPost.class));
//        SFUISchema sfuiSchema = new SFUISchema();
//        sfuiSchema.renderSchema().widget("array").build();
//
//        map.put("ui", "{\"$post\": {\"widget\": \"tabset\"},\"$post3\": {\"widget\": \"tabset\"} }");
        return uiForm;
    }
}
